package com.david.dubbo.xml;

import com.david.dubbo.xml.domain.User;
import com.david.dubbo.xml.service.DavidService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author David
 * @version V1.0
 * @Package com.david.dubbo.xml
 * @date 2021/4/11 10:02
 */
public class DavidConsumerApplication {
    public static void main(String[] args) throws InterruptedException {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:dubbo-consumer.xml");
        context.start();
        final DavidService service = context.getBean(DavidService.class);

        while (true) {
            for (int i=0;i<1000;i++){
                Thread.sleep(5);
                new Thread(new Runnable() {
                    public void run() {
                        User user = service.queryUserById(5);
                        System.out.println(user);
                    }
                }).start();
            }
        }
    }
}
